package com.zrf.geekbang.spring.bean.factory;

import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

/**
 * @author zhouruifeng
 * @date 2020-06-21
 */
public class InitializationUserFactory implements UserFactory, InitializingBean, DisposableBean {

    @PostConstruct
    public void postConstruct() {
        System.out.println("user factory init, PostConstruct");
    }

    public void beanInitMethod() {
        System.out.println("user factory init, Bean");
    }

    @Override
    public void afterPropertiesSet() throws Exception {
        System.out.println("user factory init, afterPropertiesSet ");
    }

    @PreDestroy
    public void PreDestroy() {
        System.out.println("bean destroy: @PreDestroy");
    }

    @Override
    public void destroy() throws Exception {
        System.out.println("bean destroy: DisposableBean");
    }

    public void doDestory() {
        System.out.println("bean destroy: doDestory");
    }
}
